package com.study;

import com.study.util.FileUtil;

import java.util.List;

/**
 * TODO
 *
 * @author wanghuilong
 * @version 1.0
 * @date 2021/12/29 7:55 下午
 */
public class Test7 {


    public static void main(String[] args) {
        String sql1 = "update sku set standard_sku_code = '${0}',spu_code = '${1}',spu_name='${2}' where sku_code = '${3}';";


        String sql2 = "update item set standard_sku_code = '${0}',spu_code = '${1}' where item_code = '${4}';";

        List<String> strings = FileUtil.readTxtFileIntoStringArrList("/Users/wanghuilong/IdeaProjects/lazy/src/main/resources/file/5.txt", null);
        for (String str : strings) {
            String[] split = str.trim().split("\t");
            String actSql1 = sql1;
            String actSql2 = sql2;
            for (int i = 0; i < split.length; i++) {
                String matchStr = "${" + i + "}";
                actSql1 = actSql1.replace(matchStr, split[i]);
                actSql2 = actSql2.replace(matchStr, split[i]);
            }
            System.out.println(actSql1);
            System.out.println(actSql2);
        }
    }

}
